#ifndef __MARS_GRAPHICS_RENDEROBJECT_MGR_H__
#define __MARS_GRAPHICS_RENDEROBJECT_MGR_H__

#include "MarsObject.h"
#include "MarsRenderObject.h"
#include "MarsType.h"

namespace Graphics
{

class RenderObjectMgr : public Object
{
public:
									~RenderObjectMgr();

	bool							Initialize();
	void							Shutdown();

	static RenderObjectMgr&			Instance();
	static void						Destroy();

	RenderObject*					GetFreeRenderObject() const;

private:
									RenderObjectMgr();
									RenderObjectMgr( const RenderObjectMgr& );
	RenderObjectMgr&				operator = ( const RenderObjectMgr& );

	static RenderObjectMgr*			ms_pRenderObjectMgr;

	mutable RenderObjectArray		m_arrRenderObjects;
	mutable Core::uint32			m_iCurrentFreeIndex;
};

inline RenderObjectMgr& RenderObjectMgr::Instance()
{
	if ( !ms_pRenderObjectMgr )
	{
		ms_pRenderObjectMgr = new RenderObjectMgr();
	}

	return ( *ms_pRenderObjectMgr );
}

} // end of namespace Graphics

#endif // end of #ifndef __MARS_GRAPHICS_RENDEROBJECT_MGR_H__